// 台账管理模块-接口
import request from '@/util/request';


/**
 * 查询出所有物资类型
 * @returns 
 */
export function getAllGoodsType(){
    
    return request({
        url:"/goodstype/getAllGoodsType",
        method:"GET", 
        params: null,
    });
}

/**
 * 台账-自定义属性（新增）
 * @param {*} param 
 * @returns 
 */
export function addCustomattr(param){

    const data = {
        customAttrMsg:param
    }
    return request({
        url:"/customattr/add",
        method:"POST", 
        data: data  
    });
}

/**
 * 台账-自定义属性（新增）
 * @param {*} param 
 * @returns 
 */
export function addGoods(param){

    const data = {
        goodsName: param.goodsName,
        typeId: param.typeId,
        whId: param.whId,
        goodsNum: param.goodsNum,
        unit: param.unit,
        customAttrId: param.customattrId,
        storageTime: param.storageTime,
        depositPersonName: param.depositPersonName,
        percentage: param.percentage,
    }
    return request({
        url:"/goods/add",
        method:"POST", 
        data: data  
    });
}



/**
 * 获取仓库信息通过存入人姓名
 * @param {*} param 
 * @returns 
 */
export function getWhByUseName(param){

    const data = {
        useName:param,
    }
    return request({
        url:"/warehouse/getWarehouseByUseName",
        method:"GET", 
        params: data  
    });
}

/**
 * 台账分页查询
 * @param {*} param  查询条件 
 * @param {*} page  分页条件
 * @returns 
 */
export function page(param,pageParam){
    
    const data = {
        goodsName: param.goodsName,
        typeId: param.typeId,
        addTime: param.addTime,
        page:pageParam.page,
        size:pageParam.size
    }
    return request({
        url:"/goods/page",
        method:"GET", 
        params: data  
    });
}


